<?php

namespace addons\wjgl;

use app\common\library\Menu;
use think\Addons;

//插件wjgl后台管理的菜单
//先在后台生成和配置好菜单，再导出复制到插件文件中 


/**
 * 插件
 */
class Wjgl extends Addons
{
    protected $menu = [
        [
          'name' => 'wjgl',
          'title' => '文件接收管理',
          'icon' => 'fa fa-list',
          'ismenu' => 1,
          'py' => 'w',
          'pinyin' => 'wjgl',
          'sublist' => 
          [
            [
              'name' => 'wjgl/wjgl',
              'title' => '文件接收',
              'icon' => 'fa fa-circle-o ',
              'ismenu' => 1,
              'py' => 'W',
              'pinyin' => 'Wjgl',
              'weigh' => 0,
              'sublist' => 
              [
                [
                  'name' => 'wjgl/wjgl/index',
                  'title' => '查看',
                  'icon' => 'fa fa-circle-o',
                  'ismenu' => 0,
                  'py' => 'zk',
                  'pinyin' => 'zhakan',
                  'weigh' => 0,
                ],
                [
                  'name' => 'wjgl/wjgl/recyclebin',
                  'title' => '回收站',
                  'icon' => 'fa fa-circle-o',
                  'ismenu' => 0,
                  'py' => 'hsz',
                  'pinyin' => 'huishouzhan',
                  'weigh' => 0,
                ],
                [
                  'name' => 'wjgl/wjgl/add',
                  'title' => '添加',
                  'icon' => 'fa fa-circle-o',
                  'ismenu' => 0,
                  'py' => 'tj',
                  'pinyin' => 'tianjia',
                  'weigh' => 0,
                ],
                [
                  'name' => 'wjgl/wjgl/edit',
                  'title' => '编辑',
                  'icon' => 'fa fa-circle-o',
                  'ismenu' => 0,
                  'py' => 'bj',
                  'pinyin' => 'bianji',
                  'weigh' => 0,
                ],
                [
                  'name' => 'wjgl/wjgl/del',
                  'title' => '删除',
                  'icon' => 'fa fa-circle-o',
                  'ismenu' => 0,
                  'py' => 'sc',
                  'pinyin' => 'shanchu',
                  'weigh' => 0,
                ],
                [
                  'name' => 'wjgl/wjgl/destroy',
                  'title' => '真实删除',
                  'icon' => 'fa fa-circle-o',
                  'ismenu' => 0,
                  'py' => 'zssc',
                  'pinyin' => 'zhenshishanchu',
                  'weigh' => 0,
                ],
                [
                  'name' => 'wjgl/wjgl/restore',
                  'title' => '还原',
                  'icon' => 'fa fa-circle-o',
                  'ismenu' => 0,
                  'py' => 'hy',
                  'pinyin' => 'huanyuan',
                  'weigh' => 0,
                ],
              ],
            ],
          ],
        ],
      ];
    /**
     * 插件安装方法
     * @return bool
     */
    public function install()
    {
        Menu::create($this->menu);
        return true;
    }

    /**
     * 插件卸载方法
     * @return bool
     */
    public function uninstall()
    {
        Menu::delete('wjgl');
        return true;
    }

    /**
     * 插件启用方法
     * @return bool
     */
    public function enable()
    {
        Menu::enable('wjgl');
        return true;
    }

    /**
     * 插件禁用方法
     * @return bool
     */
    public function disable()
    {
        Menu::disable('wjgl');
        return true;
    }
      /**
   * 插件升级方法
   * @return bool
   */
  public function upgrade()
  {
    //如果菜单有变更则升级菜单
    Menu::upgrade('wjgl', $this->menu);
    return true;
  }

}
